// 创建被控制端窗体，展示被控制端的桌面

const { BrowserWindow } = require("electron");
const path = require("path");

let win = null;
function create() {
  // 实例化一个渲染进程
  win = new BrowserWindow({
    width: 1000,
    height: 680,
    webPreferences: {
      // 在 webview 页集成 node
      nodeIntegration: true,
      // 禁用上下文隔离
      contextIsolation: false,
    },
  });

  win.loadFile(
    path.resolve(__dirname, "../../renderer/pages/control/index.html")
  );
}

function send(channel, ...args) {
  win.webContents.send(channel, ...args);
}

module.exports = { create, send };
